package com.topsoft.email.config;

import javax.annotation.Resource;
import javax.servlet.ServletContext;

import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;
import org.springframework.web.context.ServletContextAware;

import com.topsoft.email.service.IUserInfoService;

@Component//必须要加注解  
public class SpingInitListener implements ApplicationListener<ContextRefreshedEvent>, ServletContextAware {

	
	@Resource
	public IUserInfoService userInfoService;
	
	

	// 接受servletContext对象
	@SuppressWarnings("unused")
	private ServletContext servletContext;

	
	/**
	 * 加载完毕后调用    发送ContextRefreshedEvent事件   ,   监听去执行
	 */
	@Override
	public void onApplicationEvent(ContextRefreshedEvent event) {
		
		System.out.println("加载完毕后执行ContextRefreshedEvent事件------------------");
	}

	


    /**
     * 系统加载 ServletContext 时  执行
     */
	@Override
	public void setServletContext(ServletContext servletContext) {
		this.servletContext=servletContext;
		System.out.println("系统加载 ServletContext------------------");
	}










	
	
	
	
}